package controller;

import bean.Users;
import javaConfig.SpringJavaConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import service.UsersService;

public class JavaConfigController {

    public static void main(String[] args) {

        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext(SpringJavaConfig.class);

        Users user = (Users) context.getBean("user1");
        System.out.println(user.getName());

        UsersService us = context.getBean(UsersService.class);

        us.register(user);
    }

}
